package br.siseventos.model;
// Generated 29/10/2012 23:23:36 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TdPapel generated by hbm2java
 */
@Entity
@Table(name = "td_papel", catalog = "SisEventosDB", uniqueConstraints =
@UniqueConstraint(columnNames = "nme_papel"))
public class TdPapel extends BaseModel {

    private Integer idtPapel;
    private String nmePapel;
    private String dscPapel;
    private boolean flgPromovePapel;
    private Set<TbInscricao> tbInscricaos = new HashSet<TbInscricao>(0);

    public TdPapel() {
    }

    public TdPapel(String nmePapel, String dscPapel, boolean flgPromovePapel) {
        this.nmePapel = nmePapel;
        this.dscPapel = dscPapel;
        this.flgPromovePapel = flgPromovePapel;
    }

    public TdPapel(String nmePapel, String dscPapel, boolean flgPromovePapel, Set<TbInscricao> tbInscricaos) {
        this.nmePapel = nmePapel;
        this.dscPapel = dscPapel;
        this.flgPromovePapel = flgPromovePapel;
        this.tbInscricaos = tbInscricaos;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "idt_papel", unique = true, nullable = false)
    public Integer getIdtPapel() {
        return this.idtPapel;
    }

    public void setIdtPapel(Integer idtPapel) {
        this.idtPapel = idtPapel;
    }

    @Column(name = "nme_papel", unique = true, nullable = false, length = 80)
    public String getNmePapel() {
        return this.nmePapel;
    }

    public void setNmePapel(String nmePapel) {
        this.nmePapel = nmePapel;
    }

    @Column(name = "dsc_papel", nullable = false, length = 200)
    public String getDscPapel() {
        return this.dscPapel;
    }

    public void setDscPapel(String dscPapel) {
        this.dscPapel = dscPapel;
    }

    @Column(name = "flg_promove_papel", nullable = false)
    public boolean isFlgPromovePapel() {
        return this.flgPromovePapel;
    }

    public void setFlgPromovePapel(boolean flgPromovePapel) {
        this.flgPromovePapel = flgPromovePapel;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tdPapel")
    public Set<TbInscricao> getTbInscricaos() {
        return this.tbInscricaos;
    }

    public void setTbInscricaos(Set<TbInscricao> tbInscricaos) {
        this.tbInscricaos = tbInscricaos;
    }
    // Sobrescrevendo metodos utilitarios importantes   
    @Override
    public String toString() {
        return this.nmePapel;
    }

    @Override
    public boolean equals(Object outro) {
        return (outro instanceof TdPapel) && (this.idtPapel != null)
                ? idtPapel.equals(((TdPapel) outro).getIdtPapel())
                : (outro == this);
    }

    @Override
    public int hashCode() {
        return (idtPapel != null)
                ? (this.getClass().hashCode() + idtPapel.hashCode())
                : super.hashCode();
    }
}
